#include "main.h"

void clk_enable(void);
void led_init(void);
void delay_short(volatile unsigned int n);
void delay(volatile unsigned int n);
void led_on(void);
void led_off(void);

int main(void)
{
    clk_enable();
    led_init();
    while (1)
    {
        led_on();
        delay(500);
        led_off();
        delay(500);
    }
    return 0;
}
void led_on(void)
{
    GPIO1_DR &= ~(1 << 3);
}
void led_off(void)
{
    GPIO1_DR |= (1 << 3);
}
void led_init(void)
{
    SW_MUX_GPIO1_IO03 = 0x5;
    SW_PAD_GPIO1_IO03 = 0x10b0;
    GPIO1_GDIR = 0x8;
    GPIO1_DR = 0x8;
}
void clk_enable(void)
{
    CCM_CCGR0 = 0xffffffff;
    CCM_CCGR1 = 0xffffffff;
    CCM_CCGR2 = 0xffffffff;
    CCM_CCGR3 = 0xffffffff;
    CCM_CCGR4 = 0xffffffff;
    CCM_CCGR5 = 0xffffffff;
    CCM_CCGR6 = 0xffffffff;
}
void delay_short(volatile unsigned int n)
{
    while (n--)
    {
    }
}
void delay(volatile unsigned int n)
{
    while (n--)
    {
        delay_short(0x7ff);
    }
}
